package com.taiyuan.tongcheng.ui;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import org.json.JSONException;
import org.json.JSONObject;
import org.kymjs.kjframe.KJHttp;
import org.kymjs.kjframe.http.HttpCallBack;
import org.kymjs.kjframe.http.HttpConfig;
import org.kymjs.kjframe.http.HttpParams;
import org.kymjs.kjframe.ui.BindView;
import org.kymjs.kjframe.utils.DensityUtils;
import org.kymjs.kjframe.utils.KJLoger;
import org.kymjs.kjframe.utils.PreferenceHelper;

import android.content.Intent;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

import com.android.volley.toolbox.JsonArrayRequest;
import com.taiyuan.tongcheng.application.AppContext;
import com.taiyuan.tongcheng.http.HttpParamUtil;
import com.taiyuan.tongcheng.http.TcWebservice;
import com.taiyuan.tongcheng.http.WebData;
import com.taiyuan.tongcheng.jsonparser.TcJsParser;
import com.tytc56.user.R;

/**
 * 
* @Description APP 启动界面
* @author wzq
* @date 2015-7-23 下午7:08:48
* @update (date)
* @version V1.0
 */
public class AppStartActivity extends BaseActivity {
    public static String TAG = "appstart";
    
    @BindView(id=R.id.logo_img,click=true)
	private ImageView logoImage;

    @Override
    public void setRootView() {
		setContentView(R.layout.activity_launcher);
    }

    
    @Override
    protected void onResume() {
    	
    	super.onResume();
    }
    
    
    @Override
    protected void onPause() {
    	super.onPause();
    }
    
    @Override
    public void initWidget() {
    	super.initWidget();
//    	 getSystemConfig();
    	 Animation anim = AnimationUtils.loadAnimation(this, R.anim.splash_start);
         anim.setAnimationListener(new Animation.AnimationListener() {
             @Override
             public void onAnimationStart(Animation animation) {}

             @Override
             public void onAnimationEnd(Animation animation) {
                 jumpTo();
             }
             @Override
             public void onAnimationRepeat(Animation animation) {}
         });
         logoImage.setAnimation(anim);
         AppContext.screenH = DensityUtils.getScreenH(this);
         AppContext.screenW = DensityUtils.getScreenW(this);
    }
    
    /**
     * 
    * @Description:根据设置启动推送进程
    * @return void
    * @throws
    * @autour wzq
    * @date 2015-7-23 下午7:11:42
    * @update (date)
     */
    private void configPush() {
    	 
    }

    private void jumpTo() {
        configPush();
        boolean isFirst = PreferenceHelper.readBoolean(aty, TAG, "first_open",
                true);
        Intent jumpIntent = new Intent();
        if (!isFirst) {
            jumpIntent.setClass(aty, LoginActivity.class);
        } else {
            PreferenceHelper.write(aty, TAG, "first_open", false);
            jumpIntent.setClass(aty, LoginActivity.class);
        }
//      startActivity(jumpIntent);
        startActivity(GuangGaoActivity.class);
        finish();
    }
    
    
}
